import Sprite from "../base/Sprite.js";
import Director from "../Director.js";

class Land extends Sprite {
  constructor() {
    const image = Sprite.getImage("land")
    super(image, 0, 0, image.width, image.height, 0, window.innerHeight - image.height, image.width, image.height)
    this.speed = Director.getInstance().moveSpeed
    this.point = 0
  }
  draw() {
    this.point = this.point + this.speed
    if (this.point > (this.img.width - window.innerWidth)) this.point = 0;
    super.draw(
      this.img,
      this.sx, this.sy, this.sw, this.sh,
      -this.point, this.y, this.width, this.height
    )
  }
}

export default Land